package com.lvt.design.pattern.module.stat.v2;

/**
 * @author LT
 * @date 2023年02月22日 23:17
 */
public class ClientDemo {
    public static void main(String[] args) {
        MetricsStorage storage = new RedisMetricsStorage();
        ConsoleReporter consoleReporter = new ConsoleReporter(storage);
        consoleReporter.startRepeatedReport(60, 60);

        EmailReporter emailReporter = new EmailReporter(storage);
        emailReporter.addToAddress("xy@xx.com");
        emailReporter.startDailyReport();

        MetricsCollector controller = new MetricsCollector(storage);
        controller.recordRequest(new RequestInfo("register",123,10234));
        controller.recordRequest(new RequestInfo("register",123,11234));
        controller.recordRequest(new RequestInfo("register",123,12234));
        controller.recordRequest(new RequestInfo("login",23,12234));
        controller.recordRequest(new RequestInfo("login",1223,14234));

        try {
            Thread.sleep(100000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
